<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2744：[HEOI2012]朋友圈</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[HEOI2012]朋友圈</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[HEOI2012]朋友圈</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [HEOI2012]朋友圈                </h1>
                <p>时间限制：30s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：128MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div>
<div style="margin: 0cm 52.4pt 0pt 18pt; line-height: 15.5pt" align="left"><span style="font-size: medium"><span style="color: black">在很久很久以前，曾经有两个国家和睦相处，无忧无虑的生活着。</span><span style="color: black">一年一度的评比大会开始了，作为和平的两国，一个朋友圈数量最多的永远都是最值得</span><span style="color: black">他人的尊敬，所以现在就是需要你求朋友圈的最大数目。</span></span></div>
<div style="margin: 0cm -1.5pt 0pt 39pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black">两个国家看成是</span><span style="color: black">AB</span><span style="color: black">两国，现在是两个国家的描述：</span></span></div>
<div style="margin: 0cm -1.5pt 0pt 39pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black">1.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black">&nbsp;</span><span style="color: black">A</span><span style="color: black">国：每个人都有一个友善值，当两个</span><span style="color: black">A</span><span style="color: black">国人的友善值</span><span style="color: black">a</span><span style="color: black">、</span><span style="color: black">b</span><span style="color: black">，如果</span><span style="color: black">a xor b mod 2=1</span><span style="color: black">，</span></span></div>
<div style="margin: 0cm -1.5pt 0pt 57pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black">那么这两个人都是朋友，否则不是；</span></span></div>
<div style="margin: 0cm -1.5pt 0pt 39pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black">2.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black">&nbsp;</span><span style="color: black">B</span><span style="color: black">国：每个人都有一个友善值，当两个</span><span style="color: black">B</span><span style="color: black">国人的友善值</span><span style="color: black">a</span><span style="color: black">、</span><span style="color: black">b</span><span style="color: black">，如果</span><span style="color: black">a xor b mod 2=0</span></span></div>
<div style="margin: 0cm -1.5pt 0pt 57pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black">或者</span><span style="color: black"> (a or b)</span><span style="color: black">化成二进制有奇数个</span><span style="color: black">1</span><span style="color: black">，那么两个人是朋友，否则不是朋友；</span></span></div>
<div style="margin: 0cm -1.5pt 0pt 39pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black">3.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black">&nbsp;</span><span style="color: black">A</span><span style="color: black">、</span><span style="color: black">B</span><span style="color: black">两国之间的人也有可能是朋友，数据中将会给出</span><span style="color: black">A</span><span style="color: black">、</span><span style="color: black">B</span><span style="color: black">之间&ldquo;朋友&rdquo;的情况。</span></span></div>
</div>
<p><span style="font-size: medium"><br clear="all" />
</span></p>
<div style="margin: 0cm -1.5pt 0pt 39pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black">4.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="color: black"><span style="font-size: 11pt; color: black; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-ascii-font-family: 'Arial Unicode MS'">在</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: &quot;Arial Unicode MS&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><font face="Calibri">AB</font></span><span style="font-size: 11pt; color: black; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-ascii-font-family: 'Arial Unicode MS'">两国，朋友圈的定义：一个朋友圈集合</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: &quot;Arial Unicode MS&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><font face="Calibri">S</font></span><span style="font-size: 11pt; color: black; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-ascii-font-family: 'Arial Unicode MS'">，满足</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: &quot;Arial Unicode MS&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><font face="Calibri"> <o:p></o:p></font></span>
<p class="MsoNormal" align="left" style="margin: 0cm -1.1pt 0pt 18pt; line-height: 14.5pt; text-align: left; mso-line-height-rule: exactly; mso-layout-grid-align: none; tab-stops: 174.75pt 274.15pt 290.25pt 303.4pt 308.8pt"><span lang="EN-US" style="font-size: 11pt; color: black; font-family: 宋体; letter-spacing: 0.3pt; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">S</span><span style="font-size: 11pt; color: black; font-family: 宋体; letter-spacing: 0.3pt; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&isin;</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: Cambria; letter-spacing: 0.3pt; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">A</span><span style="font-size: 11pt; color: black; font-family: 宋体; letter-spacing: 0.3pt; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&cup;</span><span style="font-size: 11pt; color: black; font-family: Cambria; letter-spacing: 0.3pt; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"> <span lang="EN-US">B</span></span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: &quot;Arial Unicode MS&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: Cambria"><span style="mso-tab-count: 1"><font face="Calibri">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="font-size: 11pt; color: black; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: Cambria; mso-ascii-font-family: 'Arial Unicode MS'">，对于所有的</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: Cambria; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt">i</span><span style="font-size: 11pt; color: black; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: Cambria; mso-ascii-font-family: 'Arial Unicode MS'">，</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: Cambria; letter-spacing: 0.25pt; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt">j</span><span style="font-size: 11pt; color: black; font-family: 宋体; letter-spacing: 0.3pt; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&isin; </span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: Cambria; letter-spacing: 0.25pt; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;</span>S</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: &quot;Arial Unicode MS&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: Cambria"><span style="mso-tab-count: 1"><font face="Calibri"> </font></span></span><span style="font-size: 11pt; color: black; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: Cambria; mso-ascii-font-family: 'Arial Unicode MS'">，</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: Cambria; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt">i</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: &quot;Arial Unicode MS&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: Cambria"><span style="mso-tab-count: 1"><font face="Calibri"> </font></span></span><span style="font-size: 11pt; color: black; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: Cambria; mso-ascii-font-family: 'Arial Unicode MS'">和</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: Cambria; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>j</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: &quot;Arial Unicode MS&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: Cambria"><span style="mso-tab-count: 1"><font face="Calibri">&nbsp;&nbsp; </font></span></span><span style="font-size: 11pt; color: black; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: Cambria; mso-ascii-font-family: 'Arial Unicode MS'">是朋友</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: &quot;Arial Unicode MS&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: Cambria"><font face="Calibri"> <o:p></o:p></font></span></p>
<p class="MsoNormal" align="left" style="margin: 0cm 52.35pt 0pt 18pt; line-height: 16pt; text-align: left; mso-line-height-rule: exactly; mso-layout-grid-align: none"><span style="font-size: 11pt; color: black; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-ascii-font-family: 'Arial Unicode MS'">由于落后的古代，没有电脑这个也就成了每年最大的难题，而你能帮他们求出最大朋</span><span style="font-size: 11pt; color: black; font-family: &quot;Arial Unicode MS&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><font face="Calibri"> </font></span><span style="font-size: 11pt; color: black; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-ascii-font-family: 'Arial Unicode MS'">友圈的人数吗？</span><span lang="EN-US" style="font-size: 11pt; color: black; font-family: &quot;Arial Unicode MS&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><font face="Calibri"> </font></span></p>
</span></span></div></p><hr/><h3>输入格式</h3><p><p class="MsoNormal" align="left" style="margin: 0cm 52.35pt 0pt 18pt; line-height: 16pt; text-align: left; mso-line-height-rule: exactly; mso-layout-grid-align: none"><span lang="EN-US" style="font-size: 11pt; color: black; font-family: 'Arial Unicode MS'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><font face="Calibri"><o:p></o:p></font></span>&nbsp;</p>
<div style="margin: 0cm -1.5pt 0pt 39pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black">第一行</span><span style="color: black">t&lt;=6,</span><span style="color: black">表示输入数据总数。</span></span></div>
<div style="margin: 0cm -1.5pt 0pt 39pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black">接下来</span><span style="color: black">t</span><span style="color: black">个数据：</span></span></div>
<div style="margin: 0cm 55.6pt 0pt 39pt; line-height: 16pt" align="left"><span style="font-size: medium"><span style="color: black">第一行输入三个整数</span><span style="color: black">A,B,M</span><span style="color: black">，表示</span><span style="color: black">A</span><span style="color: black">国人数、</span><span style="color: black">B</span><span style="color: black">国人数、</span><span style="color: black">AB</span><span style="color: black">两国之间是朋友的对数；</span><span style="color: black">第二行</span><span style="color: black">A</span><span style="color: black">个数</span><span style="color: black">ai</span><span style="color: black">，表示</span><span style="color: black">A</span><span style="color: black">国第</span><span style="color: black">i</span><span style="color: black">个人的友善值；</span><span style="color: black">第三行</span><span style="color: black">B</span><span style="color: black">个数</span><span style="color: black">bi</span><span style="color: black">，表示</span><span style="color: black">B</span><span style="color: black">国第</span><span style="color: black">j</span><span style="color: black">个人的友善值；</span></span></div>
<div style="margin: 0cm -1.5pt 0pt 39pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black">第</span><span style="color: black">4</span><span style="color: black">&mdash;&mdash;</span><span style="color: black">3+M</span><span style="color: black">行，每行两个整数（</span><span style="color: black">i</span><span style="color: black">，</span><span style="color: black">j</span><span style="color: black">），表示第</span><span style="color: black">i</span><span style="color: black">个</span><span style="color: black">A</span><span style="color: black">国人和第</span><span style="color: black">j</span><span style="color: black">个</span><span style="color: black">B</span><span style="color: black">国人是朋友。</span></span></div></p><hr/><h3>输出格式</h3><p><div style="margin: 0cm -1.5pt 0pt 18pt; line-height: 15.75pt" align="left">&nbsp;</div>
<div style="margin: 0cm -1.5pt 0pt 39pt; line-height: 14.5pt" align="left"><span style="font-size: medium"><span style="color: black">输出</span><span style="color: black">t</span><span style="color: black">行，每行，输出一个整数，表示最大朋友圈的数目。</span></span></div></p><hr/><h3>样例输入</h3><pre>2  4 7
1  2
2  6 5 4
1  1
1  2
1  3
2  1
2  2
2  3
2  4
</pre><hr/><h3>样例输出</h3><pre>5 
【样例说明】
最大朋友圈包含A国第1、2人和B国第1、2、3人。
</pre><hr/><h3>提示</h3><p><p>【数据范围】<br />
两类数据<br />
第一类：|A|&lt;=200 |B| &lt;= 200<br />
第二类：|A| &lt;= 10 |B| &lt;= 3000<br />
&nbsp;</p></p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2744" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2744" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>